package com.cloud.hystrix.service;

import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.cloud.hystrix.entity.Person;
import com.cloud.hystrix.service.PersonService.PersonServiceFallback;

@FeignClient(name = "Provider-SOME", fallback = PersonServiceFallback.class)
public interface PersonService {

	@RequestMapping(value = "/findPerson", method = RequestMethod.POST)
	Person findPerson(Person person);

	@Component
	static class PersonServiceFallback implements PersonService {
		@Override
		public Person findPerson(Person person) {
			person.setUrl("this is Hystrix+Feign error msg!");
			return person;
		}

	}
}
